<template>
  <div class="photoinfo-container">
    <!-- 标题部分 -->
    <h3>{{photoinfo.title}}</h3>
    <p class="subtitle">
      <span>发表时间：{{photoinfo.add_time|dateFormat}}</span>
      <span>点击次数：{{photoinfo.click}}次</span>
    </p>
    <hr />
    <!-- 缩略图区域 -->
    <div class="thumbs">
      <vue-preview
      :list="list"
      :thumbImageStyle="{width: '80px', height: '80px', margin: '20px', boxShadow:'0 0 9px #333',borderRadius: '50%'}"
      :previewBoxStyle="{border: '1px solid #eee'}"
      :tapToClose="true"
    />
    </div>
    <!-- 图片内容区域 -->
    <div class="content" v-html="photoinfo.content"></div>
    <!-- 放置评论组件 -->
    <cmt-box :id="id"></cmt-box>
  </div>
</template>

<script>
import comment from "../subcomponents/comment.vue";
import icon1 from "../../images/1.png";
import icon2 from "../../images/2.png";
import icon3 from "../../images/3.png";
import icon4 from "../../images/4.png";
import icon5 from "../../images/5.png";
import icon6 from "../../images/6.png";
export default {
  data() {
    return {
      id: this.$route.params.id,
      photoinfo: {
        id: this.id,
        title: "标题",
        click: 3,
        add_time: Date.now(),
        content:
          "内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容内容"
      },
      list: [
        { src: icon1, w: 600, h: 600 },
        { src: icon2, w: 600, h: 600 },
        { src: icon3, w: 600, h: 600 },
        { src: icon4, w: 600, h: 600 },
        { src: icon5, w: 600, h: 600 },
        { src: icon6, w: 600, h: 600 }
      ]
    };
  },
  created() {
    // this.getPhotoInfo();
    // this.getThumbs();
  },
  methods: {
    // getPhotoInfo(){
    //     this.$http.get("api/getimageInfo/"+this.id).then(result=>{
    //         if(result.body.status===0){
    //             this.photoinfo=result.body.message[0];
    //         }
    //     })
    // },
    // getThumbs(){
    //     this.$http.get("api/getthumimages/"+this.id).then(result=>{
    //         if(result.body.status===0){
    //             result.body.message.forEach(item=>{
    //                 item.w=600;
    //                 item.h=400;
    //             })
    //         }
    //         this.list=result.body.message;
    //     })
    // }
  },
  components: {
    "cmt-box": comment
  }
};
</script>

<style lang="scss" scoped>
.photoinfo-container {
  padding: 3px;
  h3 {
    color: #26a2ff;
    font-size: 15px;
    text-align: center;
    margin: 15px 0;
  }
  .subtitle {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
  }
  .content {
    font-size: 13px;
    line-height: 30px;
  }
  // .thumbs {
  // }
}
</style>